package com.iakuil.app.common.core.exception;

import com.iakuil.app.common.core.enums.Results;

import java.util.Map;

/**
 * 第三方接口调用异常
 *
 * <p>调用第三方接口返回错误码时抛出的异常，比如微信开放平台接口。
 * <p>此时应该在日志中记录全部的返回信息，标明出错的平台、接口名称等。
 *
 * @author Kai
 */
public class ThirdPartyApiException extends BaseException {

    private Map<String, Object> extra;

    public ThirdPartyApiException(int code) {
        super(code);
    }

    public ThirdPartyApiException(String message) {
        super(Results.REMOTE_API_ERROR.getCode(), message);
    }

    public ThirdPartyApiException(int code, String message) {
        super(code, message);
    }

    public ThirdPartyApiException(String message, Map<String, Object> extra) {
        super(Results.REMOTE_API_ERROR.getCode(), message);
        this.extra = extra;
    }

    public ThirdPartyApiException(int code, String message, Map<String, Object> extra) {
        super(code, message);
        this.extra = extra;
    }

    public Map<String, Object> getExtra() {
        return extra;
    }

    public void setExtra(Map<String, Object> extra) {
        this.extra = extra;
    }
}
